if (JSON.parse(sessionStorage.getItem("userInfo"))) {
    let User = JSON.parse(sessionStorage.getItem("userInfo"));
    let obj = {
        "uid": User.id,
        "gid": gid
    }
    console.log(obj);
    $.ajax({
        url: "../../mengbasha/server/cart/deleteGoodByGid.php",
        data: obj,
        type: "post"
    }).then(function (res) {
        console.log(res);
    })
} else {
    //未登录
    if ($.cookie("carts")) {
        let cookieList = JSON.parse($.cookie("carts"));
        console.log(cookieList);
        cookieList.some((ele, index) => {
            if (ele.gid == gid) {
                cookieList.splice(index, 1);
                $.cookie("carts", JSON.stringify(cookieList));
            }
        })
    }
}
